import Page
from Page import Personal
from Base.Base import Base
from selenium.webdriver.common.by import By


class PersonalFaceRecognitionPage(Base):
    """
    人脸识别界面
    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 左侧的home键
        self.face_home_btn = (By.XPATH, Personal.RESOURCE_ID.format("ivHome"))

        # 左侧的返回键
        self.face_back_btn = (By.XPATH, Personal.RESOURCE_ID.format('ivBack'))

        # 页面标题
        self.face_title_text = (By.XPATH, Personal.RESOURCE_ID.format("title"))

        # 页面提示
        self.face_tip_concern_text = (By.XPATH, Personal.RESOURCE_ID.format("tips"))

        # 绑定按钮
        self.face_binding_btn = (By.XPATH, Personal.RESOURCE_ID.format("btn"))

    def click_home(self):
        """
        点击左侧的home键

        :return:None
        """
        self.click_element(self.face_home_btn)

    def click_back(self):
        """
        点击左侧的back键

        :return:None
        """
        self.click_element(self.face_home_btn)

    def get_title(self):
        """
        人脸识别标题

        :return: 元素对象
        """
        return self.find_element_o(self.face_title_text)

    def get_tip_concern(self):
        """
        人脸识别内容提示

        :return: 元素对象
        """
        return self.find_element_o(self.face_tip_concern_text)

    def click_binding(self):
        """
        点击去绑定按钮

        :return: None
        """
        self.click_element(self.face_binding_btn)

    def is_display_personal_face_recognition(self):
        """
        是否进入人脸识别界面

        :return: bool
        """
        return self.is_display(self.face_title_text)
